package org.lanqiao.tjut.control;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.lanqiao.tjut.bean.ScoreBean;
import org.lanqiao.tjut.service.ServiceFactory;

public class TeaQueryStuClass extends HttpServlet {

	private static final long serialVersionUID = 1L;

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		// 接收客户端数据请求时进行编码设置，防止中文乱码
		// request.setCharacterEncoding("UTF-8");
		// 获取id的主键值
		String classname = request.getParameter("classname");
		String teaname=request.getParameter("teaname");
		// 根据主键值获取数据库中的主键对象
		List<ScoreBean> lst = ServiceFactory.getSelectClassManagerServiceInstance().getStuInfoByClassName(classname,teaname);
		// 将获取结果放入request缓存中
		request.getSession().setAttribute("stuBean1", lst);
		// 跳转
		request.getRequestDispatcher("SelectClass/TeaQueryStuClass.jsp").forward(request, response);

	}

	@Override
	public void destroy() {
		// TODO Auto-generated method stub
		super.destroy();
	}

	@Override
	public void init() throws ServletException {
		// TODO Auto-generated method stub
		super.init();
	}

}
